package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("fos.txt");

        //将文件fos.txt中的数据读取出来
        FileInputStream fis = new FileInputStream("fos.txt");
        long len = file.length();//获取文件长度(字节数)
        byte[] data = new byte[(int) len];
        fis.read(data);
        String line = new String(data, StandardCharsets.UTF_8);
        System.out.println(line);
        fis.close();
    }
}
